package com.zj.study.filter;

import com.zj.study.config.properties.JwtConfigurationProperty;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.servlet.HandlerInterceptor;

/**
 * web 拦截器
 *
 * @author 赵赳
 * @since 2021/12/15 9:49
 */
@Log4j2
public class WebHandlerInterceptor implements HandlerInterceptor {

  private final JwtConfigurationProperty jwtConfigurationProperty;

  public WebHandlerInterceptor(
      JwtConfigurationProperty jwtConfigurationProperty) {
    this.jwtConfigurationProperty = jwtConfigurationProperty;
  }


  @Override
  public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
      Object handler) {
    //var authorization = request.getHeader("Authorization");
    //if (!jwtConfigurationProperty.getAccessToken().equals(authorization)) {
    //  log.debug("请求校验失败，token:{}", authorization);
    //  response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    //  return false;
    //}

    return true;
  }


}
